package com.demo.jnistatic;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    String TAG = "MainActivity.java";
    static {
        System.loadLibrary("native-lib");
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.i(TAG, "onCreate" );
        TextView tv = findViewById(R.id.sample_text);
        String hello = stringFromJNI();
        Log.i(TAG, "onCreate hello = " + hello);
        int age = intFromJNI(18);
        Log.i(TAG, "onCreate age = " + age);
        tv.setText(hello);
    }

    public native String stringFromJNI();
    public native int intFromJNI(int age);
}
